package hflyeer.gitee.com.service.impl;

import hflyeer.gitee.com.dao.EmployeeDao;
import hflyeer.gitee.com.entity.Employee;
import hflyeer.gitee.com.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("employeeService")
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeDao employeeDao;

    public void add(Employee employee) {
        employeeDao.insert(employee);
    }

    public void remove(int id) {
        employeeDao.delete(id);
    }

    public void edit(Employee employee) {
        employeeDao.update(employee);
    }

    public Employee findOne(int id) {
        Employee employee = employeeDao.selectOne(id);
        return employee;
    }

    public List<Employee> find() {
        List<Employee> employees = employeeDao.select();
        return employees;
    }
}
